#ifndef __CAPP_H__
#define __CAPP_H__

#include <iostream>
#include <string>
#include <fstream>
#include <cmath>
#include <vector>
#include <stdio.h>
#include <fstream>
#include <map>
#include <sstream>
#include "agg_basics.h"
#include "agg_rendering_buffer.h"
#include "agg_rasterizer_scanline_aa.h"
#include "agg_scanline_u.h"
#include "agg_renderer_scanline.h"
#include "agg_pixfmt_rgb.h"
#include "platform/agg_platform_support.h"
#include "ctrl/agg_slider_ctrl.h"
#include "ctrl/agg_cbox_ctrl.h"
#include "agg_glyph_raster_bin.h"
#include "agg_renderer_raster_text.h"
#include "agg_embedded_raster_fonts.h"
#include "agg_rounded_rect.h"
#include "agg_span_allocator.h"
#include "agg_span_gradient.h"
#include "agg_span_interpolator_linear.h"
#include "agg_arc.h"


#include "CNode.h"
extern double radiusCentre;
extern double radiusWifi;
class CApp : public agg::platform_support
{
  double m_dx;
  double m_dy;
  int    m_idx;
	CNode *m_N_select;

  agg::slider_ctrl<agg::rgba8> m_slider1;
  agg::slider_ctrl<agg::rgba8> m_slider2;

public:
typedef agg::renderer_base<agg::pixfmt_bgr24> ren_base;
  agg::path_storage ps;
  agg::conv_stroke<agg::path_storage> *pg;
  agg::scanline_u8 sl;
  ren_base *ren;
  agg::ellipse ell;
  //agg::arc cer;
  agg::pixfmt_bgr24 *pixf;
  // transformation de vectoriel en bit
  agg::rasterizer_scanline_aa<> ras;
  //agg::rasterizer_scanline_aa<> ras1;
  bool ref;
  double av,ap;

  CApp(agg::pix_format_e format, bool flip_y);
  virtual ~CApp(){}
  virtual void on_init(){}

  void refreshNetwork();
  void on_draw();

  virtual void on_mouse_button_down(int x, int y, unsigned flags);
  virtual void on_mouse_move(int x, int y, unsigned flags);

  virtual void on_mouse_button_up(int x, int y, unsigned flags);
	virtual void on_key(int x, int y, unsigned key, unsigned flags);
};

#endif // __CAPP_H__
